//
//  NSDictionary+SafeAccess.h
//  category
//
//  Created by MAC on 2018/5/5.
//  Copyright © 2018年 MAC. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface NSDictionary (SafeAccess)

- (BOOL)ex_hasKey:(NSString *)key;

- (NSString*)ex_stringForKey:(id)key;

- (NSNumber*)ex_numberForKey:(id)key;

- (NSDecimalNumber *)ex_decimalNumberForKey:(id)key;

- (NSArray*)ex_arrayForKey:(id)key;

- (NSDictionary*)ex_dictionaryForKey:(id)key;

- (NSInteger)ex_integerForKey:(id)key;

- (NSUInteger)ex_unsignedIntegerForKey:(id)key;

- (BOOL)ex_boolForKey:(id)key;

- (int16_t)ex_int16ForKey:(id)key;

- (int32_t)ex_int32ForKey:(id)key;

- (int64_t)ex_int64ForKey:(id)key;

- (char)ex_charForKey:(id)key;

- (short)ex_shortForKey:(id)key;

- (float)ex_floatForKey:(id)key;

- (double)ex_doubleForKey:(id)key;

- (long long)ex_longLongForKey:(id)key;

- (unsigned long long)ex_unsignedLongLongForKey:(id)key;

- (NSDate *)ex_dateForKey:(id)key dateFormat:(NSString *)dateFormat;

//CG
- (CGFloat)ex_CGFloatForKey:(id)key;

- (CGPoint)ex_pointForKey:(id)key;

- (CGSize)ex_sizeForKey:(id)key;

- (CGRect)ex_rectForKey:(id)key;
@end

#pragma --mark NSMutableDictionary setter

@interface NSMutableDictionary(SafeAccess)

-(void)ex_setObj:(id)i forKey:(NSString*)key;

-(void)ex_setString:(NSString*)i forKey:(NSString*)key;

-(void)ex_setBool:(BOOL)i forKey:(NSString*)key;

-(void)ex_setInt:(int)i forKey:(NSString*)key;

-(void)ex_setInteger:(NSInteger)i forKey:(NSString*)key;

-(void)ex_setUnsignedInteger:(NSUInteger)i forKey:(NSString*)key;

-(void)ex_setCGFloat:(CGFloat)f forKey:(NSString*)key;

-(void)ex_setChar:(char)c forKey:(NSString*)key;

-(void)ex_setFloat:(float)i forKey:(NSString*)key;

-(void)ex_setDouble:(double)i forKey:(NSString*)key;

-(void)ex_setLongLong:(long long)i forKey:(NSString*)key;

-(void)ex_setPoint:(CGPoint)o forKey:(NSString*)key;

-(void)ex_setSize:(CGSize)o forKey:(NSString*)key;

-(void)ex_setRect:(CGRect)o forKey:(NSString*)key;
@end

